<?php

/**
 * Mailbox form.
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormTemplate.php 10377 2008-07-21 07:10:32Z dwhittle $
 */
class MailboxForm extends BaseMailboxForm
{
  public function configure()
  {
  	unset( 
  		$this['created_at'],  
  		$this['updated_at'],  
  		$this['pub'], 
  		$this['del_sender'], 
  		$this['del_resiver'], 
  		$this['comment'],
  		$this['translate'],
  		$this['fl_read'],
                $this['from_partner_id'],
                $this['to_partner_id'],
  		$this['to_id'],
  		$this['fl_translate']);
  	
  		
  	  $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
  	  'from_id'          => new sfWidgetFormInputHidden( array (), array ('value' => sfContext::getInstance()->getUser()->getAttribute( 'user_id', null, 'sfGuardSecurityUser' ))),
  	  'body' => new sfWidgetFormTextarea(array(),array('class'=>'mailbox_body','style'=>'width:90%;')),
    ));
    
    
    		  /////Статус ссылки
		 if(!sfConfig::get('app_mail_personal') or sfConfig::get('app_mail_personal')==false)
		 {
		 		$this->widgetSchema['title'] =  new sfWidgetFormInput(array(),array('size'=>50));		 		
		 		 $this->widgetSchema['to_user'] =  new sfWidgetFormInput(array(),array('size'=>10));
		 		 $this->widgetSchema->moveField('title', 'after', 'id');
		 		 $this->widgetSchema->moveField('to_user', 'after', 'id');
		 }
		 else 
		 {
		 	$this->widgetSchema['to_user'] =  new sfWidgetFormInputHidden();
		 	 
		 }
		 ////
    
    
    $this->validatorSchema->setOption ( 'allow_extra_fields', true );
    $this->widgetSchema->setNameFormat('mailbox[%s]');
    
    //$this->embedI18n(sfContext::getInstance()->getUser()->getLangs());
    
      	   // $js_path = '/js/tiny_mce/tiny_mce.js';
           //sfContext::getInstance()->getResponse()->addJavascript($js_path);
    
  }
}
